import { NavBar, Space, Toast } from 'antd-mobile'

import './navbar.css'

import React, { Component } from 'react';
import styled from 'styled-components';
import { location, useNavigate } from 'react-router-dom';

const Container = styled.div`
  & {
    position: sticky;
    left: 0;
    top: 0;
    z-index: 9;
  }
`

  const CNavBar = (props) => {   
    const navigate = useNavigate()
    return (
      <Container>
        <NavBar className='nav' 
          backArrow={props.attr.backArrow || false} 
          {...props.attr} 
          onBack={() => navigate(-1)} 
        >{props.attr.title || '标题'}</NavBar>
      </Container>
    );
  }

export default CNavBar;
